Raw TCP socket communication for UTCP
The TCP provider enables UTCP to interact directly with services over raw TCP sockets, allowing for low-level network communication with minimal protocol overhead. This provider is ideal for high-performance applications or legacy systems using custom TCP protocols.
TCP providers are configured using the following JSON structure:
{ "name": "tcp_service", "provider_type": "tcp", "host": "api.example.com", "port": 9000, "timeout": 30000, "keep_alive": false, "encoding": "utf-8" }
Field | Required | Description |
---|---|---|
name |
Yes | Unique identifier for the provider |
provider_type |
Yes | Must be set to "tcp" |
host |
Yes | Hostname or IP address of the TCP server |
port |
Yes | Port number of the TCP server |
timeout |
No | Connection and operation timeout in milliseconds (default: 30000 ) |
keep_alive |
No | Whether to keep connections alive between requests (default: false ) |
encoding |
No | Text encoding for string data (default: "utf-8" ) |
buffer_size |
No | Buffer size for reading data (default: 4096 ) |
Since TCP is a raw transport protocol, implementations need to define:
How to determine message boundaries (length prefixes, delimiters, fixed-size messages)
Format for sending structured data (JSON, Protocol Buffers, custom binary formats)
How errors are communicated within the protocol
Since raw TCP doesn't support standardized discovery protocols, UTCP tools using TCP providers typically rely on:
/utcp
{ "name": "tcp_service", "provider_type": "tcp", "host": "api.example.com", "port": 9000, "discovery_url": "https://api.example.com/utcp" }
{ "name": "time_server", "provider_type": "tcp", "host": "time.example.com", "port": 13, "timeout": 5000, "encoding": "ascii" }
{ "name": "custom_service", "provider_type": "tcp", "host": "service.example.com", "port": 8080, "keep_alive": true, "buffer_size": 8192, "timeout": 60000 }
© 2024 Universal Tool Calling Protocol. All rights reserved.